<!--#include file="Config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->
<%

intID=int(Request("id"))
ActionType=request("ActionType")
SaveType=request("SaveType")

'Add
if ActionType="Add" or ActionType="" then
AName="确定增加"
URL="?SaveType=AddOK"
end if

'Mod
if ActionType="Mod" and intID<>"" then
AName="确定修改"
sql="select * from CRM_PersonList where P_id="&Intid
rs.open sql,conn,1,1
Personname=Trim(rs("name"))
PersonInfo=Trim(rs("Info"))
PersonID=int(rs("P_id"))
rs.close
AID=intID
URL="?SaveType=ModOK&ID="&intID
end if

'SaveAdd
if SaveType="AddOK" and request("name")<>"" then
sql="select * from CRM_PersonList where P_id is null"
rs.open sql,conn,1,3
rs.addnew
rs("name")=Trim(Request("name"))
rs("Info")=Trim(Request("Info"))
rs("IsShow")=1
rs("AddTime")=Now()
rs("EMP_ID")=session("emp_ID")
rs.Update
rs.close
end if

'SaveMod
if SaveType="ModOK" and intID<>"" and request("name")<>"" then
sql="select * from CRM_PersonList where P_id="&IntID
rs.open sql,conn,1,3
rs("name")=Trim(Request("name"))
rs("Info")=Trim(Request("Info"))
rs.Update
rs.close

end if
%>

<!--添加  -->
<table class="table">
<form method="post" action="<%=URL%>" name="form1">
<tr>
<td>
Name:<input type="text" name="name" value="<%=Personname%>">
Info:<input type="text" name="Info" value="<%=PersonInfo%>">
<input type="submit" name="Submit" value="<%=aname%>">
<A HREF="?ActionType=Add">[<U><FONT COLOR="#FF0000"><B>增加</B></FONT></U>]</A>
</td>
</tr>
</form>
</table>

<table class="table">
<tr>
<td>ID</td>
<td>Name</td>
<td>Info</td>
</tr>
<%

sql="select  * from CRM_PersonList order by P_ID desc"
rs.open sql,conn,1,1
rcount=rs.recordcount
if pmcount="" or isempty(pmcount) or pmcount<1 then
pmcount=page_num_max_per
end if
rs.pagesize=pmcount   '设置每页数
mpage=rs.pagecount'得到总页数
pageno=request("pageno")
if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
pageno=1
end if
if rcount<>0 then
rs.absolutepage=pageno'将指针移至指定页的第一条记录
end if
loopno=pmcount
do while not rs.eof and loopno>0
%>
<tr>
<td ><%=int(rs("P_ID"))%></td>
<td><%=Trim(rs("Name"))%></td>
<td><%=Trim(rs("info"))%></td>
</tr>
<%
rs.movenext
loopno=loopno-1
loop
rs.close
%>


<TR>
<TD colspan=10>
<%showpage()%>
</td>
</TR>
</TABLE>

<!--#include file="Footer.asp" -->

